package com.buba.customer.controller;

import com.buba.customer.pojo.China;
import com.buba.customer.service.ChinaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;

import java.util.List;
import java.util.Map;

/**
 * 中国地址控制层类
 */
@Controller
@RequestMapping("/China")
public class ChinaController {
    private ChinaService chinaService;

    /**
     * 查询地址信息
     * @param pid  根据父级id查询
     * @return
     */
    @RequestMapping("/selChina.do")
    @ResponseBody
    public Map<String,Object> selChina(Integer pid){
        Map<String,Object> map = new HashMap<>();

        List<China> list = chinaService.selChina(pid);
        map.put("data",list);
        return map;
    }





    public ChinaService getChinaService() {
        return chinaService;
    }
    @Autowired
    public void setChinaService(ChinaService chinaService) {
        this.chinaService = chinaService;
    }
}
